program Test;

{$APPTYPE CONSOLE}
{$R *.res}

uses
  System.SysUtils,
  DiscuzAPI in '..\source\DiscuzAPI.pas',
  Discuz.Constants in '..\source\Discuz.Constants.pas',
  Discuz.Structures in '..\source\Discuz.Structures.pas';

type
  TKostyl = class
    procedure OnMsg(Sender: TObject; MsgVal, MsgString: String);
    procedure OnChng(Sender: TObject);
  end;

var
  API: TDiscuzAPI;
  KKK: TKostyl;
  { TKostyl }

procedure TKostyl.OnChng(Sender: TObject);
begin
  // Writeln(API.Source);
end;

procedure TKostyl.OnMsg(Sender: TObject; MsgVal, MsgString: String);
begin
  Writeln(MsgVal + ' ' + MsgString);
end;

var
  x: integer;

begin
  KKK := TKostyl.Create;
  API := TDiscuzAPI.Create;
  try
    API.OnMessage := KKK.OnMsg;
    API.OnChangeSource := KKK.OnChng;
    // API.Login('LockerMan', 'LockerMan');
    // API.Friends('3');
    with API.Friends('3') do
    begin
      for x := 0 to Count - 1 do
        Writeln(Items[x].A);
    end;

    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  API.Free;
  KKK.Free;
  Readln;

end.
